/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package decore.core;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Dola
 */
public class DBConnection {
    
    private static Connection connection;
    private static boolean  connected = false;
    
    public static void Connect(){
        try {
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/decore", "root", "");
            connected = true;
        } catch (SQLException ex) {
            Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public static void Disconnect(){
        try {
            connection.close();
            connected = false;
        } catch (SQLException ex) {
            Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static boolean isConnected() {
        return connected;
    }
    
    public static Connection getConnection() {
        return connection;
    }
    
}
